home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / A-B / BibliographyManager.cpt / Bibliography Manager II / Bib. Man. II Cards / stack.txt < prev   
Text File  |  1990-10-01  |  10KB  |  305 lines

  1. -- stack: in. II Cards
  2. -- format: 8 (HyperCard 1)
  3. -- flags: 0x1000 (none)
  4. -- protect password hash: 0
  5. -- maximum user level: 5 (scripting)
  6. -- window: Rect(x1=0, y1=0, x2=0, y2=0)
  7. -- screen: Rect(x1=0, y1=0, x2=0, y2=0)
  8. -- card dimensions: w=0 h=0
  9. -- scroll: x=0 y=0
  10. -- background count: 1
  11. -- first background id: 2763
  12. -- card count: 1
  13. -- first card id: 75250
  14. -- list block id: 2056
  15. -- print block id: 0
  16. -- font table block id: 0
  17. -- style table block id: 0
  18. -- free block count: 0
  19. -- free size: 0 bytes
  20. -- total size: 61216 bytes
  21. -- stack block size: 9216 bytes
  22. -- created by hypercard version: 0x00000000
  23. -- compacted by hypercard version: 0x01208000
  24. -- modified by hypercard version: 0x01208000
  25. -- opened by hypercard version: 0x01208000
  26. -- patterns[0]: 0x0000000000000000
  27. -- patterns[1]: 0x8000000008000000
  28. -- patterns[2]: 0x8800220088002200
  29. -- patterns[3]: 0x8888222288882222
  30. -- patterns[4]: 0x88AA22AA88AA22AA
  31. -- patterns[5]: 0xCCAA33AACCAA33AA
  32. -- patterns[6]: 0xEEAABBAAEEAABBAA
  33. -- patterns[7]: 0xEEBBBBEEEEBBBBEE
  34. -- patterns[8]: 0xFFBBFFEEFFBBFFEE
  35. -- patterns[9]: 0xFFBBFFFFFFBBFFFF
  36. -- patterns[10]: 0x8010022001084004
  37. -- patterns[11]: 0xFFFFFFFFFFFFFFFF
  38. -- patterns[12]: 0x8822882288228822
  39. -- patterns[13]: 0x1122448811224488
  40. -- patterns[14]: 0xC4800C6843023026
  41. -- patterns[15]: 0xB130031BD8C00C8D
  42. -- patterns[16]: 0xAA00AA00AA00AA00
  43. -- patterns[17]: 0x8822552288225522
  44. -- patterns[18]: 0x8855225588552255
  45. -- patterns[19]: 0x77DD77DD77DD77DD
  46. -- patterns[20]: 0x8000000000000000
  47. -- patterns[21]: 0xAA55AA55AA55AA55
  48. -- patterns[22]: 0x038448300C020101
  49. -- patterns[23]: 0x8244394482010101
  50. -- patterns[24]: 0x8814224188412214
  51. -- patterns[25]: 0x8080413E080814E3
  52. -- patterns[26]: 0x22048C7422179810
  53. -- patterns[27]: 0xBE808808EB088880
  54. -- patterns[28]: 0x25C8328964244C92
  55. -- patterns[29]: 0xA29C41BE2AC914EB
  56. -- patterns[30]: 0x40A00000040A0000
  57. -- patterns[31]: 0x8040200002040800
  58. -- patterns[32]: 0xAA00800088008000
  59. -- patterns[33]: 0xFF80808080808080
  60. -- patterns[34]: 0x081C22C180010204
  61. -- patterns[35]: 0xFF808080FF080808
  62. -- patterns[36]: 0xF87422478F172271
  63. -- patterns[37]: 0xBF00BFBFB0B0B0B0
  64. -- patterns[38]: 0xFF7FBE5DA2418000
  65. -- patterns[39]: 0xFAF5FAF5A050A050
  66. -- checksum: 0x0
  67. ----- HyperTalk script -----
  68. on openStack
  69.   hide MenuBar
  70.   global stype, coping, activef, writetype, sandwm
  71.   put empty into sandwm
  72.   hide message
  73.   if coping <> "Yes" then
  74.     set the name of bg btn 31 to "Stack: " && the short name of this stack
  75.     put the short name of this stack into activef
  76.     put 0 into stype
  77.     put empty into writetype
  78.   end if
  79.   pass openStack
  80. end openStack
  81.  
  82. -- BIB. MAN. II CARDS v. 1.2
  83. -- LAST UPDATE: 9/30/90
  84.  
  85. function DelEntry
  86. global userlevel
  87. put "Checking for Details..."
  88. lock screen
  89. put the userlevel into ulev
  90. set the userlevel to 3
  91. if the script of this cd = "d" then             -- DELETE DETAILS CARD
  92.   put "Deleting Details for Reference Number " & fld Rnum & "..."
  93.   click at 475,247                                 --CLICK SHOW BUTTON
  94.   get the script of this bg
  95.   if it = "xyzzy" then
  96.     if (the number of cds of bg DetBkgnd) < 2 then
  97.       repeat with i = 3 to 6
  98.         put empty into fld i
  99.       end repeat
  100.     else
  101.       doMenu Delete Card
  102.     end if
  103.   else
  104.     beep
  105.     answer "ERROR:  Could not locate Details stack"
  106.   end if
  107.   pop cd --RETURN TO DATA STACK CARD (PUSHED IN SHOW BUTTON SCRIPT)
  108. end if
  109. put "Deleting Reference Number " & fld Rnum & "..." -- DELETE BIB. STACK CARD
  110. if (the number of cds of bg "Data Card bkgnd") < 2 then
  111.   repeat with i = 1 to 7
  112.     put empty into fld i
  113.   end repeat
  114.   set the script of fld Rnum to "1"
  115. else
  116.   doMenu Delete Card
  117. end if
  118. set the userlevel to ulev
  119. end DelEntry
  120.  
  121. function FormAuthor Fir,fmt
  122. if fmt = 1 then
  123.   put last word of Fir into Las
  124.   delete last word of Fir
  125.   repeat until last char of Las <> space and last char of Las <> "."
  126.     delete last char of Las
  127.   end repeat
  128. else
  129.   put first word of Fir into Las
  130.   delete first word of Fir
  131. end if
  132. if last char of Las <> "," then put "," after Las
  133. put 1 into i
  134. repeat for the number of words in Fir
  135.   repeat until last char of word i of Fir <> ","
  136.     delete last char of word i of Fir
  137.   end repeat
  138.   if the number of chars in word i of Fir = 1 then put "." after word i of Fir
  139.   add 1 to i
  140. end repeat
  141. repeat until last char of Fir <> space
  142.   delete last char of Fir
  143. end repeat
  144. return Las && Fir
  145. end FormAuthor
  146.  
  147. function FormInAuth inAuth
  148. global inauthform
  149. put empty into lastauth
  150. put offset (" and ",inAuth) into ans   --FIND LAST AUTHOR IF HAS "AND"
  151. if ans = 0 then put offset (" & ",inAuth) into ans            --OR "&"
  152. if ans <> 0 then
  153.   put return into char ans of inAuth
  154.   delete word 1 of line 2 of inAuth
  155.   put FormAuthor(line 2 of inAuth,line 2 of inauthform) into lastauth
  156.   delete line 2 of inAuth
  157.   delete last char of inAuth
  158. end if
  159. if the number of words in inAuth < 4 then
  160.   put FormAuthor(inAuth,line 1 of inauthform) into outtxt
  161.   if lastauth is not empty then put return & lastauth after outtxt
  162.   return outtxt
  163. end if
  164. put the number of words in inAuth into wdcnt
  165. if line 3 of inauthform = 1 then --IF NO SEPARATING COMMAS CHECK RATIO
  166.   put empty into lnloc                           --OF NAMES TO INITALS
  167.   repeat with i = 1 to wdcnt
  168.     if the number of chars in word i of inAuth > 2 then
  169.       put i & return after lnloc
  170.     end if
  171.   end repeat
  172.   put the number of lines in lnloc into lnnum
  173.   if lnnum < 2 or wdcnt < 4 then            --IF ALL WORDS INITIALS OR
  174.     --ONLY < 4 WORDS, ASSUME ONLY ONE NAME AND RETURN OUTTXT
  175.     put FormAuthor(inAuth,line 1 of inauthform) into outtxt
  176.     if lastauth is not empty then put return & lastauth after outtxt
  177.     return outtxt
  178.   end if                                                          --ELSE
  179.   if lnnum/wdcnt < 0.5 then      --IF RATIO < 1/2, ASSUME LONG NAMES
  180.     if line 1 of inauthform = 1 then                --ARE LAST NAMES
  181.       if line 2 of inauthform = 1 then   --IF ALL F L, THEN ARE LOCS
  182.         put lnloc into nlocs
  183.       else                        --ELSE DERIVE LOCS OF END OF NAMES
  184.         if line 1 of lnloc <> line 2 of lnloc - 1 then
  185.           put line 1 of lnloc - 1 & return into nlocs
  186.         else
  187.           put line 1 of lnloc & return into nlocs
  188.         end if
  189.         if lnnum < 3 then
  190.           put wdcnt after nlocs
  191.         else
  192.           repeat with i = 3 to lnnum
  193.             put (line i of lnloc) - 1 & return after nlocs
  194.           end repeat
  195.           put wdcnt after nlocs
  196.         end if
  197.       end if
  198.     else                               --IF FIRST AUTHOR IS L F THEN
  199.       if line 2 of inauthform = 1 then       --IF COAUTHORS F L THEN
  200.         if line 1 of lnloc = 1 then delete line 1 of lnloc
  201.         if line 1 of lnloc > 3 then put (line 1 of lnloc) - 3 & return before lnloc
  202.         put lnloc into nlocs
  203.       else
  204.         put empty into nlocs
  205.         if line 1 of lnloc <> 1 then
  206.           repeat with i = 1 to lnnum
  207.             put (line i of lnloc) - 1 & return after nlocs
  208.           end repeat
  209.         else
  210.           delete line 1 of lnloc
  211.           repeat with i = 1 to lnnum-1
  212.             put (line i of lnloc) - 1 & return after nlocs
  213.           end repeat
  214.         end if
  215.         put wdcnt after nlocs
  216.       end if
  217.     end if
  218.   else  --ELSE... THAT IS, IF CAN'T ASSUME LONG NAMES ARE LAST NAMES
  219.     put empty into nlocs
  220.     put 3 into i                --DO BY THREES AND HOPE FOR THE BEST
  221.     repeat until i >= wdcnt
  222.       put i & return after nlocs
  223.       add 3 to i
  224.     end repeat
  225.     put wdcnt after nlocs
  226.   end if
  227. else                                  --IF THERE ARE SEPARATING COMMAS
  228.   put empty into nlocs  --IF ALL L, F THEN NAMES END AT EACH 2ND COMMA
  229.   if line 1 of inauthform = 3 and line 2 of inauthform = 3 then
  230.     put 0 into cnt
  231.     repeat with i = 1 to wdcnt
  232.       if last char of word i of inAuth = "," then add 1 to cnt
  233.       if cnt = 2 then
  234.         put i & return after nlocs
  235.         put 0 into cnt
  236.       end if
  237.     end repeat
  238.     if last line of nlocs <> wdcnt then
  239.       put wdcnt after nlocs
  240.     end if
  241.   else                                     --ELSE (NAMES NOT ALL L, F)
  242.     if line 1 of inauthform = 3 then
  243.       put 0 into i           --IF FIRST AUTHOR IS L, F THEN FIND FIRST
  244.       put 0 into cnt   --AUTHOR (ENDS AT 2ND COMMA); REST WILL BE DONE
  245.       repeat until i = 2  --WITH OTHER CHOICE (NO COMMAS WITHIN NAMES)
  246.         add 1 to cnt
  247.         if last char of word cnt of inAuth = "," then add 1 to i
  248.         if cnt = wdcnt then exit repeat
  249.       end repeat
  250.       put cnt & return after nlocs
  251.       add 1 to cnt
  252.     else
  253.       put 1 into cnt
  254.     end if
  255.     repeat with i = cnt to wdcnt    --DO FOR ANY THAT ONLY HAVE COMMAS
  256.       if last char of word i of inAuth = "," then --SEPARATING AUTHOR
  257.         put i & return after nlocs    --NAMES (NO COMMAS WITHIN NAMES)
  258.       end if
  259.     end repeat
  260.     if last line of nlocs <> wdcnt then put wdcnt after nlocs
  261.   end if
  262. end if
  263. put empty into toauthform             --WRITE NAMES TO TEXT FOR OUTPUT
  264. repeat with i = 1 to line 1 of nlocs                 --DO FIRST AUTHOR
  265.   put word i of inAuth & space after toauthform
  266. end repeat
  267. put FormAuthor(toauthform,line 1 of inauthform) & return into outtxt
  268. put empty into toauthform
  269. put the number of lines in nlocs into nnums
  270. repeat with i = 2 to nnums                              --DO COAUTHORS
  271.   repeat with j = ((line (i - 1) of nlocs) + 1) to line i of nlocs
  272.     put word j of inAuth & space after toauthform
  273.   end repeat
  274.   put FormAuthor(toauthform,line 2 of inauthform) & return after outtxt
  275.   put empty into toauthform
  276. end repeat
  277. if lastauth is not empty then put lastauth after outtxt     --ADD LAST
  278. return outtxt                       --AUTHOR (IF HAD "AND") AND RETURN
  279. end FormInAuth
  280.  
  281. on closeCard
  282.   global sandwm
  283.   if sandwm is empty then
  284.     if the short name of this bg = "Data Card bkgnd" then
  285.       repeat with i = 1 to 4
  286.         set scroll of fld round(1 + i*1.4) to 0
  287.       end repeat
  288.     end if
  289.   end if
  290. end closeCard
  291.  
  292. on idle
  293.   global seltext, sandwm
  294.   if (sandwm = 996) and (the short name of this bg = "Data card bkgnd") then
  295.     put 995 into sandwm
  296.     click at the loc of bg btn "Find Next Match"
  297.   else
  298.     if the selection is empty then
  299.       put empty into seltext
  300.     else
  301.       put the selectedtext & return & the selectedfield into seltext
  302.     end if
  303.   end if
  304. end idle
  305.